<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>分配权限</title>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
	$(function()
	{
		$('input').click(function()
			{
				var level=$(this).attr('level');
				if(level==1)
				{
					var str='_';
					var inputs=$('input[value*='+str+']');
					$(this).attr('checked')?inputs.attr('checked',true):inputs.removeAttr('checked');
				}
		});	
	});

	function ExtendedStyle(sType,oInput)
	{
		switch(sType)
		{
			case "focus":
				oInput.isfocus=true;
				oInput.className='inputtextfocus';
				break;
			case "mouseover":
				if(!oInput.isfocus)
				{
					oInput.className='inputtexthover';
				}
				break;

		}
	}
/*$(function(){
	$('input[level=1]').click(function(){
		var inputs=$(this).parents('.app').find('input');
		$(this).attr('checked') ? inputs.attr('checked','checked') : inputs.removeAttr('checked');
	});
	$('input[level=2]').click(function(){
		var inputs=$(this).parents('dl').find('input');
		$(this).attr('checked') ? inputs.attr('checked','checked') : inputs.removeAttr('checked');
	});
});*/
</script>
</head>

<body>
<form action="<?php echo U('admin/RBAC/setAccess');?>" method="post">
	<div id="wrap">
		<a href="<?php echo U('admin/RBAC/relo');?>" class="add-app">返回</a>
		<div style="text-indent: 20px">你当前的用户组为:<span style="font-weight:bold;font-size: 15px;color:blue"><?php echo ($name); ?></span></div>
		<?php if(is_array($nodelist)): $i = 0; $__LIST__ = $nodelist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><p style="text-indent:<?php echo ($vo['level']*30); ?>px;<?php if($vo["level"] == 3): ?>float:left;margin-right:-40px;<?php else: ?>clear:both;<?php endif; ?>">
				<input id="<?php echo ($vo["id"]); ?>" type="checkbox" name="access[]" value="<?php echo ($vo["id"]); ?>_<?php echo ($vo["level"]); ?>" pid="<?php echo ($vo["pid"]); ?>" level="<?php echo ($vo["level"]); ?>"<?php if($vo['access']): ?>checked='checked'<?php endif; ?>/>
					<?php if($vo["level"] == 1): ?><span style="font-weight: bold">【项目】</span><?php elseif($vo["level"] == 2): ?><span>【模块】</span><?php endif; ?>
					<lebel name="name" value="<?php echo ($vo["id"]); ?>"><?php echo ($vo['title']); ?></lebel>
				</p><?php endforeach; endif; else: echo "" ;endif; ?>
		
	</div>
	<input type="hidden" name="id" value="<?php echo ($id); ?>">
	<input type="submit" value="保存修改" style="display:block; margin:20px auto; cursor:pointer"/>
	</form>
</body>
</html>